package ac.notification.manager;

import java.util.HashMap;
import java.util.Map;

import ac.notification.event.NotificationEvent;

public class NotificationWarehouse {

	private static NotificationWarehouse notificationWarehouse = null;
	private Map<String,NotificationEvent> notificationDB = null;
	
	public NotificationWarehouse(){
		notificationDB = new HashMap<String, NotificationEvent>();
	}
	
	public static NotificationWarehouse getNotificationWarehouse() {
		if(null == notificationWarehouse)
		{
			notificationWarehouse = new NotificationWarehouse();
		}
		return notificationWarehouse;
	}
	
	public void addNotification(NotificationEvent notificationEvent)
	{
		getNotificationWarehouse().notificationDB.put(notificationEvent.getNotificationId(),notificationEvent);
	}
	
	public NotificationEvent getNotificationEvent(String notificationId)
	{
		return getNotificationWarehouse().notificationDB.get(notificationId);
	}
	
	public void removeNotification(String notificationId)
	{
		getNotificationWarehouse().notificationDB.remove(notificationId);
	}
}
